.TH std::unique_lock::operator= 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::unique_lock::operator= \- std::unique_lock::operator=

.SH Synopsis
   unique_lock& operator=( unique_lock&& other );  \fI(since C++11)\fP

   Move assignment operator. Replaces the contents with those of other using move
   semantics.

   If prior to the call *this has an associated mutex and has acquired ownership of it,
   the mutex is unlocked.

.SH Parameters

   other - another unique_lock to replace the state with

.SH Return value

   *this

.SH Exceptions

   Throws nothing.

   Defect reports

   The following behavior-changing defect reports were applied retroactively to
   previously published C++ standards.

      DR    Applied to             Behavior as published              Correct behavior
                       the move assignment operator was noexcept,
   LWG 2104 C++11      but it may                                    it is not noexcept
                       throw an exception in the case of undefined
                       behavior^[1]

    1. ↑ For example, *this is constructed with std::adopt_lock, but the calling thread
       does not have the ownership of the associated mutex. In this case, *this cannot
       properly release the ownership of the associated mutex, and it may result in an
       exception to be thrown.
